﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace SX.Utils
{
    public static class TokenHelper
    {
        private static string TokenKey {
            get {
                return "token";
            }
        }
        public static int CheckToken(out string message) {
            message = "";
            var context = HttpContext.Current;
            if (context.Request.Headers.HasKeys() && context.Request.Headers.AllKeys.ToList().Contains(TokenKey))
            {
                string token = context.Request.Headers[TokenKey];
                
                return 0;
            }
            else
            {
                message = "no token";
                return -1;
            } 
        }
         
    }
}
